/* settings.h - this file is part of PixelMerge
 *
 * Copyright (C) 2010 Pascal Giard
 *
 * Author: Pascal Giard <evilynux@gmail.com>
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This file is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef SETTINGS_H
#define SETTINGS_H

#include <ogcsys.h>
#include <mxml.h>
#include "gettext.h"

#define DEF_ALPHA 172
#define NBR_VALID_LANG 4

enum {
  PINK,
  DARK_BLUE,
  YELLOW,
  RED,
  LIGHT_BLUE,
  GREEN
};

enum {
  EASY,
  NORMAL,
  HARD,
  NBR_DIFF
};

typedef struct {
  u8 record[3];
  u8 autoSave;
  u8 language[3];
} UserSettings;

typedef struct {
  s16 offsetX;
  s16 offsetY;
  u8 scaleX;
  u8 scaleY;
} VideoSettings;

typedef struct {
  u8 nbrRows;
  u8 nbrSteps;
  u16 size;
} BoardSettings;

class Settings {
 private:
  void loadDefault();
  bool loadFile();
  u8 validLanguages[NBR_VALID_LANG];
  u8 curValidLang;
  enum { ARRAY_USER, ARRAY_CONSOLE, ARRAY_DEFAULT };
 public:
  UserSettings user;
  VideoSettings video;
  BoardSettings board[NBR_DIFF];
  Settings();
  ~Settings();
  bool save();
  void resetRecords();
  const char * getLanguage(u8 lang);
  const char * getLanguage(); // Return current
  const char * getNextValidLanguage();
  const char * getPreviousValidLanguage();
  void reloadLanguage();
};

#endif /* SETTINGS_H */
